/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package auditenergetic;
import javax.xml.parsers.*;
import org.xml.sax.helpers.*;
import org.xml.sax.*;
import java.io.*;



public class Handler_Cladiri extends DefaultHandler implements Values
    {
        boolean destinatie = false;
        boolean tip = false;
        boolean subtip = false;
        boolean pereti = false;
       // boolean age = false;
        @Override
        public void startElement(String nsURI, String strippedName,String tagName, Attributes attributes)
        throws SAXException
        {
            if (tagName.equalsIgnoreCase("destinatie"))
                destinatie = true;
            if (tagName.equalsIgnoreCase("tip"))
                tip = true;
            if (tagName.equalsIgnoreCase("subtip"))
                subtip = true;
            if(tagName.equalsIgnoreCase("pereti"))
                pereti = true;

        }
        @Override
        public void characters(char[] ch,int start, int length)
        {
             if (destinatie)
            {
               //("Destinatia Cladirii: " + new String(ch,start,length));
                destinatie = false;
            }
            if (tip)
            {
                System.out.println("Tipul Cladirii: " + new String(ch,start,length));
                tip = false;
            } else if (subtip)
            {
                System.out.println("CLasa: " + new String(ch,start,length));
                subtip = false;
            } else if (pereti)
            {

                System.out.println("Pereti: "+new String(ch,start,length));
                String a = new String(ch,start,length);
                if (a.equalsIgnoreCase("BCA"))
                {
                    Clasa_Inertie.Compute(beton_celular,mortar_ciment_var);
                }
                if(a.equalsIgnoreCase("zidarie"))
                {
                    Clasa_Inertie.Compute(caramizi_pline,mortar_ciment_var);
                }
                if(a.equalsIgnoreCase("ba"))
                {
                    Clasa_Inertie.Compute(beton_armat,mortar_ciment_var,pasla_minerala);
                }
                if(a.equalsIgnoreCase("GVP"))
                {
                    Clasa_Inertie.Compute(caramizi_goale,mortar_ciment_var,beton_celular);
                }

                pereti = false;
            }

        }
    }

